Skip to content

fix(wizard): run the install commit in the terminal and offer a retry when hooks block it - #700

Merged
theCodeDrift merged 2 commits into
mainfrom
fix/wizard-commit-hooks
Nov 17, 2026
Merged

theCodeDrift merged 2 commits into
mainfrom
fix/wizard-commit-hooks

Conversation

@theCodeDrift

Copy link
Copy Markdown
Member

From onboarding feedback: the installer looked hung on a project with lefthook pre-commit checks, and after cancelling there was no clear way back into the installer.

The commit looked hung. The wizard's offer to commit the install ran git commit with its output captured. git sends hook output to stderr, so anything lefthook printed, prompts included, went into a buffer, and a slow or interactive hook left a blank screen.

  • git now gets the terminal directly (stdio: "inherit"), exactly as if the person typed git commit. Hook output, colors and interactive displays render normally. The wizard says the hooks are running before git starts.
  • Ctrl-C stops git and its hooks, not the wizard. The install and the onboarding prompt survive.
  • Trade-off: git's error text is no longer captured. On a failure the wizard says its output is above.

A commit that does not go through gets a choice. After a refusal or a Ctrl-C the wizard asks: try again, commit without running git hooks (--no-verify), or leave it. Hooks are the project's rules, so they are skipped only when the person picks that option, never by default.

Cancel messages pointed at init. Both said to run init to try again, but init is the no-prompt install and never opens the installer. They now point at the bare command.

Tests cover a refusal followed by leaving it, an explicit commit without hooks, hooks running again on a retry, the running-hooks message, and the cancel message. The Ctrl-C path was checked by hand: a hook running sleep 30 and a SIGINT to the process group stopped git, and the process reported the commit as stopped and kept going.

@theCodeDrift

Copy link
Copy Markdown
Member Author

@claude /review

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @theCodeDrift's task in 3m 50s —— View job


Review complete

  • Read prior review data (.prior-review.json) — no prior threads/reviews/comments found
  • Fetch PR diff and metadata
  • Review packages/cli/src/install/uncommitted.ts
  • Review packages/cli/src/wizard/steps/commit.ts
  • Review packages/cli/src/wizard/index.ts
  • Review test changes
  • Post final review

Review mode: incremental — read 0 prior review thread(s) before reviewing. .prior-review.json held no prior review threads, reviews, or top-level comments beyond the trigger itself, so this is the first substantive review of this PR — the whole diff is assessed fresh below.

Summary

The change is well-scoped and the stated problem (captured stderr hiding hook output/prompts, making the wizard look hung) is fixed correctly: commitInstall now spawns git commit with stdio: "inherit" so hooks render normally, and a refusal or Ctrl-C now routes into a retry/skip-hooks/leave choice instead of a dead end. The init → bare-command wording fix in wizard/index.ts is accurate (confirmed against src/index.ts, which only launches the wizard on a bare, no-flag invocation). Test coverage for the new retry/skip-hooks/message paths is solid and exercises real git + hooks rather than mocking git.

[New] One finding posted inline on packages/cli/src/install/uncommitted.ts (around runInTerminal, line 181): the new SIGINT handler is registered with process.on and only ever cleared when the child's close/error fires, so every SIGINT press during a commit is silently swallowed with no escalation path. This diverges from this codebase's own established convention in packages/cli/src/rules/run-directory.ts (process.once, explicitly letting a second signal fall through to terminate the process). If a hook traps/ignores SIGINT or doesn't die promptly, the person has no way to force-abandon a hung commit via repeated Ctrl-C. Worth considering process.once (or removing the listener after the first signal) to restore that escalation path.

Everything else I looked at — the added.ok error propagation, the retry loop's re-staging on each attempt, the skipHooks gating (only offered once, never offered by default), the cancel-message updates, and the test harness changes (mock select routing for "What now?" prompts, the hook-marker retry test, hasCommit helper) — checked out correctly. No other correctness, security, or clarity issues found in this diff.

Comment thread packages/cli/src/install/uncommitted.ts Resolved
@theCodeDrift
theCodeDrift merged commit 2ee2f8a into main Nov 17, 2026
5 checks passed
@theCodeDrift
theCodeDrift deleted the fix/wizard-commit-hooks branch November 17, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant